//
//  BZHomeTableViewCell.swift
//  weibo
//
//  Created by zzx on 2017/7/30.
//  Copyright © 2017年 zzx. All rights reserved.
//

import UIKit
import SnapKit

class BZHomeTableViewCell: UITableViewCell {

    //引用viewModel
    var statusViewModel: BZStatusViewModel?{
        didSet{
            
            originalView.statusViewModel = statusViewModel
            
        }
        
    }
    
    //MARK:-- 懒加载
    
    fileprivate lazy var originalView: BZHomeOriginalView = BZHomeOriginalView()
    
    //MARK:-- 转发微博视图
    fileprivate lazy var reweetView: BZHomeReweetView = BZHomeReweetView()
    
    
    //添加toolBar
    fileprivate lazy var toolBar: BZHomeToolBar = BZHomeToolBar()
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        setupUI()
        
        
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    //MARK:- 搭建界面
    private func setupUI() {
        
        contentView.addSubview(originalView)
        contentView.addSubview(toolBar)
        contentView.addSubview(reweetView)
        
        ///约束
        originalView.snp.makeConstraints { (make) in
            
            make.top.leading.trailing.equalTo(contentView)
            
        }
        
        
        reweetView.snp.makeConstraints { (make) in
            
            make.top.equalTo(originalView.snp.bottom)
            
            make.leading.trailing.equalTo(originalView)
            
            make.height.equalTo(35)

            
            
        }
        
        toolBar.snp.makeConstraints { (make) in
            
            make.top.equalTo(reweetView.snp.bottom)
            
            make.leading.trailing.equalTo(reweetView)
            
            make.height.equalTo(35)
            
            make.bottom.equalTo(contentView)
            
        }
        
        
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
